<template>
  <view
    class="prod-items"
    :data-prodid="item.id"
    @tap="toProdPage"
  >
    <view class="hot-imagecont">
      <image
        :src="item.cover"
        class="hotsaleimg"
      />
    </view>
    <view class="hot-text">
      <view class="hotprod-text">
        {{ item.title }}
      </view>
      <view
        class="prod-info"
      >
        课时：{{ item.lessonNum }} 观看：{{ item.viewCount }}
      </view>
      <view class="prod-text-info">
        <view class="price">
          <text
            class="deadline-price"
          >
            价格：
          </text>
          <text 
            v-if="item.price===0"
            class="symbol">
            免费
          </text>
          <text 
            v-if="item.price!=0"
            class="symbol">
            ￥
          </text>
          <text
            v-if="item.price!=0" 
            class="big-num">
            {{ wxs.parsePrice(item.price)[0] }}
          </text>
          <text
            v-if="item.price!=0" 
            class="small-num">
            .{{ wxs.parsePrice(item.price)[1] }}
          </text>
        </view>
      </view>
    </view>
  </view>
</template>
<script setup>
const wxs = number()
// eslint-disable-next-line no-unused-vars
const props = defineProps({
  item: {
    type: Object,
    default: () => {
      return null
    }
  },
  sts: {
    type: Number,
    default: () => {
      return 2
    }
  }
})

const toProdPage = (e) => {
  const prodid = e.currentTarget.dataset.prodid
  uni.navigateTo({
    url: '/pages/prod/prod?prodid=' + prodid
  })
}
</script>

<style scoped lang="scss">
@use './production.scss';
</style>
